package com.example.entity;

import java.util.Date;

/**
 * 评价实体类
 * @author System
 * @date 2024
 */
public class Review {
    private Long id;
    private Long userId;
    private Long productId;
    private Integer rating; // 评分 1-5星
    private String content;
    private Integer status; // 0-待审核 1-已通过 2-已拒绝
    private Date createTime;
    private Date updateTime;
    private String productImageUrl;

    // 关联查询字段
    private String username;
    private String productName;

    public Review() {}

    public Review(Long userId, Long productId, Integer rating, String content,String productImageUrl) {
        this.userId = userId;
        this.productId = productId;
        this.rating = rating;
        this.productImageUrl = productImageUrl;
        this.content = content;
        this.status = 1; // 默认通过
        this.createTime = new Date();
        this.updateTime = new Date();
    }

    public String getProductImageUrl() {
        return productImageUrl;
    }

    public void setProductImageUrl(String productImageUrl) {
        this.productImageUrl = productImageUrl;
    }

    // Getter和Setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public Integer getRating() {
        return rating;
    }

    public void setRating(Integer rating) {
        this.rating = rating;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    @Override
    public String toString() {
        return "Review{" +
                "id=" + id +
                ", userId=" + userId +
                ", productId=" + productId +
                ", rating=" + rating +
                ", content='" + content + '\'' +
                ", status=" + status +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", username='" + username + '\'' +
                ", productName='" + productName + '\'' +
                '}';
    }
}